﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace Bamboo.Utils
{
    public static class MD5Cipher
    {
        /// <summary>
        /// 计算输入字符串的MD5码
        /// </summary>
        /// <param name="input">输入的明文</param>
        /// <returns></returns>
        public static string MakeMD5(string input)
        {
            var md5 = new MD5CryptoServiceProvider();
            var v1 = md5.ComputeHash(Encoding.Default.GetBytes(input));
            var v2 = new StringBuilder(128);
            foreach (var item in v1)
            {
                v2.Append(item.ToString("x2"));
            }
            return v2.ToString();
        }
    }
}
